<?php 
include_once('connection/connection.php');
include('header.php');
include('menu.php');
include('config.php');
$block=$_SESSION['form_id'];
$district=$_SESSION['district'];
?>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Bactrological</title>
<style type="text/css">

.style10 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 9px; color:#000000}
.style11 {font-size: 9px}

</style>
</head>
<body>
<?php
 $distId= $district;//418;//$_REQUEST['distId'];
 $blockId=$block;//4308;//$_REQUEST['blockId'];

function getName($blockId)
         {
	$sqlgetName="select distinct block_name from tbl_lookup_location where block_id=".$blockId;
	$querygetName=mysql_query($sqlgetName);
	$rowgetName=mysql_fetch_row($querygetName);
	return $rowgetName[0];
         }

function getHP($distId,$blockId,$status,$scheme)
         {
	$sqlgetHP="SELECT count(source_type) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_loc a where a.id=src.loc_id and a.district_id='".$distId."' and a.block_id='".$blockId."' and src.functional_status='$status' and src.source_type like '$scheme'";
	$querygetHP=mysql_query($sqlgetHP);
	$rowgetHP=mysql_fetch_row($querygetHP);
	return $rowgetHP[0];
         }
function getBact($distId,$blockId,$status,$pos,$scheme)
         {
		  if(($distId == 391) || ($distId == 393) || ($distId == 396) || ($distId == 400) || ($distId == 405) || ($distId == 411) || ($distId == 414))
	           {
	$sqlgetHP="SELECT count(bact) FROM tbl_dtls_q3_water_source_detail src,tbl_dtls_q3_loc a where a.id=src.loc_id and a.district_id='".$distId."' and a.block_id='".$blockId."' and src.functional_status='$status' and src.bact='$pos' and src.source_type like '$scheme'";
	$querygetHP=mysql_query($sqlgetHP);
	$rowgetHP=mysql_fetch_row($querygetHP);
	return $rowgetHP[0];
	            }else{
				echo "N/A";
				}
         }
//Select Data from lookup location table village wise
/*$sqlReport = "SELECT  distinct detail.source_type,detail.functional_status,detail.bact FROM tbl_dtls_q3_water_source_detail detail,tbl_dtls_q3_loc loc WHERE loc.id=detail.loc_id and loc.district_id='$distId' and loc.block_id='$blockId' order by detail.source_type";
$queryReport = mysql_query($sqlReport);*/



//find lpcd for district
/*if(($distId == 389) || ($distId ==390) || ($distId == 391) || ($distId ==392) || ($distId == 401) || ($distId == 402) || ($distId == 403) || ($distId == 404) || ($distId == 405) || ($distId == 406) || ($distId == 416))
{
	$lpcd=70;
}
else
{
	$lpcd=40;
}*/

?>
<table border="0" width="592" cellspacing="0" cellpadding="0">
	<tr>
		<td width="592" height="26" bgcolor="#E9E9E9">
		<p align="center"><span style="font-size: 9pt; font-weight: 700">
	  <font face="Verdana" color="#224568">Bacterological Report</font></span></td>
	</tr>
	<tr>
	<td bgcolor="#E9E9E9" align="center">&nbsp;
		<span style="font-size: 9pt; font-weight: 20">
	  <font face="Verdana" style="font-size: 9.5pt" color="#000000">BLOCK:&nbsp;<font face="Verdana" style="font-size: 9.5pt" color="#000000"><?php echo getName($blockId);?></font></font></span></td>
    </tr>
	<tr>
	  <td height="14"><div align="center"><font face="Verdana" style="font-size: 9pt; font-weight: 700" color="#224568">&nbsp;</font></div></td>
  </tr>
	
	<tr>
	  <td height="135"><table border="1" width="592" cellspacing="0" cellpadding="0" height="299" bordercolor="#FFFFFF" style="border: 1px solid #BBD1E8" bgcolor="#F9F9F9">
        <tr bgcolor="#C5D8EB">
          <td colspan="2" rowspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Source Type</font></td>
          <td height="42" colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Functional Status</font></td>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">Bacterological</font></td>
        </tr>
        <tr bgcolor="#C5D8EB">
          <td width="78" height="32" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">F</font></td>
          <td width="76" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">NF</font></td>
          <td width="95" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">POS.</font></td>
          <td width="100" align="center"><font face="Verdana" style="font-size: 9.5pt" color="#000000">NEG.</font></td>
        </tr>
        <?php
			
			/*while($rowReport = mysql_fetch_array($queryReport)) 
			{
			$sourceType=$rowReport['source_type'];		*/	
			
			?>
        <tr>
          <td width="69" height="23" rowspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Handpump</font></td>
          <td width="160" height="23" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Govt.</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','HpGovt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','HpGovt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','HpGovt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','HpGovt%');?></font></td>
        </tr>
        <tr>
          <td height="22" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Pvt.</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','HpPvt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','HpPvt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','HpPvt%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','HpPvt%');?></font></td>
        </tr>
		
		<tr>
          <td height="26" colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Tube Well</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','TW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','TW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','TW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','TW%');?></font></td>
        </tr>
		<tr>
          <td height="25" colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Dug Well</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','DW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','DW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','DW%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','DW%');?></font></td>
        </tr>
		<tr>
          <td height="24" colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Rain Water Tanka</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','RainTanka%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','RainTanka%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','RainTanka%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','RainTanka%');?></font></td>
        </tr>
		<tr>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Surface water resources (River/ Dam/ Lake/ Pond/ Stream</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','Surface_water%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','Surface_water%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','Surface_water%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','Surface_water%');?></font></td>
        </tr>
		<tr>
          <td height="25" colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Irrigation Canal</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','canal%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','canal%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','canal%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','canal%');?></font></td>
        </tr>
		<tr>
          <td colspan="2" align="center"><font face="Verdana" style="font-size: 9pt" color="#000000">Others (Specify Baori, public tanka (size)
Govt. 	Pvt.</font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'F','Other%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getHP($distId,$blockId,'NF','Other%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','yes','Other%');?></font></td>
          <td align="center"><font face="Verdana" style="font-size: 9pt" color="#000000"><?php echo getBact($distId,$blockId,'F','no','Other%');?></font></td>
        </tr>
        <?php /*}*/ ?>
      </table></td>
	</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>